package com.shixi.shixitraining.shixitraining.ui.tabmine.adapter;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;

import com.shixi.shixitraining.shixitraining.R;
import com.shixi.shixitraining.shixitraining.ui.tabhome.activity.OverseaApplyActivity;
import com.shixi.shixitraining.shixitraining.ui.tabmine.entity.JobCollectBean;
import com.shixi.shixitraining.shixitraining.view.recycleview.BaseAdapter;
import com.shixi.shixitraining.shixitraining.view.recycleview.BaseRecycleHolder;

import java.util.List;

/**
 * Created by shenyan on 2018/7/27.
 */

public class CollectEmploymentAdapter extends BaseAdapter<JobCollectBean.DataBean.ListsBean> {

//    private  RequestManager  manager;
    public CollectEmploymentAdapter(Context context, List<JobCollectBean.DataBean.ListsBean> data) {
        super(context, data);
//        this.manager=manager;
    }

    @Override
    public void convert(BaseRecycleHolder holder, final JobCollectBean.DataBean.ListsBean item, int position) {
        holder.setText(R.id.collect_employment_title_tv,item.getTitle());
        holder.setText(R.id.employment_business_tv,item.getTrade_name());
        holder.setText(R.id.employment_address_tv,item.getAddress());
        holder.setText(R.id.employment_job_tv,item.getDuration_name());

        TextView mApply = holder.getView(R.id.employmet_apply);
        mApply.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                String id = item.getId();

                Bundle bundle=new Bundle();
                bundle.putString("id",id);
                Intent intent=new Intent(mContext, OverseaApplyActivity.class);
                intent.putExtras(bundle);
                mContext.startActivity(intent);
            }
        });
    }

    @Override
    protected int getLayoutId(int viewType) {
        return R.layout.adapter_mine_collect_employment;
    }
}
